package com.createidea.cms.service.enterprise;

import java.io.File;
import java.util.Date;
import java.util.List;

import com.createidea.cms.dao.enterprise.EnterpriseDao;
import com.createidea.cms.to.EnterpriseTo;
import com.createidea.cms.to.PictureTo;
import com.createidea.cms.utils.FileUtil;

public class EnterpriseServiceImpl implements EnterpriseService {
    private EnterpriseDao enterpriseDao;

	public EnterpriseDao getEnterpriseDao() {
		return enterpriseDao;
	}

	public void setEnterpriseDao(EnterpriseDao enterpriseDao) {
		this.enterpriseDao = enterpriseDao;
	}

	@Override
	public List<EnterpriseTo> getEnterprise() {
		// TODO Auto-generated method stub
		return enterpriseDao.getEnterprises();
	}

	
	public void saveEnterprise(EnterpriseTo enterprise) {
		// TODO Auto-generated method stub
		enterpriseDao.saveEnterprise(enterprise);
	}


	@Override
	public EnterpriseTo getEnterprise(String enterpriseId) {
		// TODO Auto-generated method stub
		return enterpriseDao.getEnterprise(enterpriseId) ;
	}

	@Override
	public EnterpriseTo getEnterpriseInfo() {
		// TODO Auto-generated method stub
		return enterpriseDao.getEnterprise();
	}

	@Override
	public void setPictureAsDefault(String enterpriseId,String pictureId) {
		// TODO Auto-generated method stub
		EnterpriseTo enterprise=enterpriseDao.getEnterprise(enterpriseId);
		enterprise.setLogo(new PictureTo(pictureId));
		enterpriseDao.saveOrUpdateEnterprise(enterprise);
	}
     
     
}
